package com.redrose.audioandvideo.ui;

import androidx.navigation.NavController;
import androidx.navigation.Navigation;

import android.view.View;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.redrose.audioandvideo.R;
import com.redrose.audioandvideo.databinding.ActivityScrollBinding;
import com.redrose.audioandvideo.ui.activitys.BaseActivity;
import com.redrose.audioandvideo.utils.ScrollUIControl;

@Route(path = "/activity/scroll")
public class ScrollActivity extends BaseActivity<ActivityScrollBinding> implements View.OnClickListener {

    private NavController navController;

    @Override
    public void initData() {
        mBinding.btnNavigation.setOnClickListener(this);
        mBinding.btnSearch.setOnClickListener(this);
        mBinding.btnSetting.setOnClickListener(this);
        navController = Navigation.findNavController(this, R.id.host_fragment);
        ScrollUIControl.getInstance().initScrollUIControl(mBinding);
    }

    @Override
    public int setLayout() {
        return R.layout.activity_scroll;
    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        switch (id) {
            case R.id.btn_navigation:
                navController.navigate(R.id.navi_fragment);
                ScrollUIControl.getInstance().statusMax();
                break;
            case R.id.btn_search:
                navController.navigate(R.id.search_fragment);
                ScrollUIControl.getInstance().statusMid();
                break;
            case R.id.btn_setting:
                navController.navigate(R.id.setting_fragment);
                ScrollUIControl.getInstance().statusMin();
                break;
            default:
                break;
        }
    }
}
